const nodeXlsx = require('node-xlsx')

let filegain = async (path) => {
    return new Promise((resolve, reject) => {
        const ex1 = nodeXlsx.parse(path);
        let excel_content = ex1[0].data;
        if (excel_content) {
            excel_content.splice(0, 1);
            resolve(excel_content);
        } else {
            reject("未获取到内容，请检查上传文件的内容！")
        }
    }).then(data => data
    ).catch(error => {
        throw new Error(error)
    })
}

module.exports = {
    filegain,
}